package long_link

import (
	"fmt"
	"github.com/go-resty/resty/v2"
)

func PushMessage(hostAndPort string, operation string, mids string, tp string, data string) (interface{}, error) {
	client := resty.New()
	resp, err := client.R().
		SetHeader("Content-Type", "application/json").
		SetBody(struct {
			Type string `json:"type"`
			Data string `json:"data"`
		}{
			Type: tp,
			Data: data,
		}).
		Post(fmt.Sprintf("http://%s/goim/push/mids?operation=%s&mids=%s", hostAndPort, operation, mids))
	return resp, err
}
